using System;
using UnityEngine;

public class RoomTrigger : MonoBehaviour
{
	public static bool playerInRoom;

	public static event Action<bool> PlayerInRoom;

	private void OnTriggerEnter(Collider other)
	{
		if (other.tag.Equals("Player") && other.gameObject == GameController.instance.playerScript.gameObject)
		{
			if (RoomTrigger.PlayerInRoom != null)
			{
				RoomTrigger.PlayerInRoom(true);
			}
			playerInRoom = true;
		}
	}

	private void OnTriggerExit(Collider other)
	{
		if (other.tag.Equals("Player") && other.gameObject == GameController.instance.playerScript.gameObject)
		{
			if (RoomTrigger.PlayerInRoom != null)
			{
				RoomTrigger.PlayerInRoom(false);
			}
			playerInRoom = false;
		}
	}
}
